<extend name="./Public/templete/base.html" />
<!-- 标题   -->
<block name="title">
    <title>学习记录文件下载</title>
</block>
<!-- 添加该页面对应需要的css文件 -->
<block name="link">
    <link rel="shortcut icon" src="./favicon.ico" />
    <link rel="stylesheet" type="text/css" href="../../../Public/source/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="../../../Public/source/css/manage.css">
</block>
<!-- 右下侧的主体内容 主要内容在此处写 -->
<!-- 文件上传按钮-->
<block name="content">
    <div class="layui-body">
        <div style="padding: 15px;">

            <!-- 文件展示块-->
            <i class="layui-icon layui-icon-face-surprised" style="font-size: 20px;"></i>
            <label>&nbsp;学习记录文件下载</label>
            <div style="padding-left: 40px;padding-top: 30px;">

                <table class="layui-hide" id="LAY_table_user" lay-filter="useruv" for="0a">
                </table>

            </div>

</block>




<block name="js">


    <script type="text/html" id="barDemo">
	   
	    <a class="layui-btn layui-btn-sm" lay-event="dow">下载</a>
		
	</script>
    <script src="../../../Public/source/layui/layui.js"></script>
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script type="text/javascript">


        layui.use('table', function () {
            var table = layui.table;

            //接收表格数据

            table.render({
                elem: '#LAY_table_user'
                , height: 680
                , url: "{:U('File/PassStudy')}" //数据接口
                , page: true //开启分页
                , id: 'testReload'
                , cols: [[ //表头
                    { field: 'id', title: 'ID', sort: true, fixed: 'left' }
                    , { field: 'file', title: '文件名', width: 700 }
                    , { field: 'date', title: '上传时间', sort: true }
                    , { field: 'name', title: '上传人' }
                    , { field: 'right', title: '操作', toolbar: "#barDemo", fixed: 'right' }
                ]]

            });

            //下载按钮

            table.on('tool(useruv)', function (obj) {
                var data = obj.data;
                var r = data.savefile;
                console.log(r);
                $(this).attr("href", "../../../Public/Note/" + r);

                $(this).attr("download", data.file);
            });
        });

layui.use('element', function(){
  var element = layui.element;
});

    </script>
</block>